{include file="member.header.login.html"}
<script type="text/javascript">
$(function(){
<!-- {if $step eq 1}-->	   
    $('#find_password_form').validate({
        errorPlacement: function(error, element) { 
			element.parent().append(error);
		},
		success       : function(label){
            label.addClass('validate_right').text('OK!');
        },	
        onkeyup : false,
        rules : {
            username : {
                required : true,
          isCheckAccount : true,
                remote   : {
                    url :'index.php?app=find_password&act=check_user&ajax=1',
                    type:'get',
                    data:{
                        username : function(){
                            return $('#username').val();
                        }
                    }
                }
            },
            captcha : {
                required : true,
                remote   : {
                    url : 'index.php?app=captcha&act=check_captcha',
                    type: 'get',
                    data:{
                        captcha : function(){
                            return $('#captcha1').val();
                        }
                    }
                }
            }
        },
        messages : {
            username : {
                required : '账户名不能为空',
          isCheckAccount : '账户名不正确',
                remote   : '您提供的账户名不存在'
            },
            captcha : {
                required : '验证码不能为空',
                remote   : '验证码错误'
            }
        }
    });
<!-- {/if}-->

<!-- {if $step eq 2}-->
<!-- {if $set_type eq 'email'}-->
  $('#find_password_form').validate({
       errorPlacement: function(error, element) { 
			element.parent().append(error);
		},
        success       : function(label){
            label.addClass('validate_right').text('OK!');
        },
        onkeyup: false,
        rules : {
            captcha : {
                required : true,
                remote   : {
                    url : 'index.php?app=captcha&act=check_captcha',
                    type: 'get',
                    data:{
                        captcha : function(){
                            return $('#captcha1').val();
                        }
                    }
                }
            }           
        },
        messages : {            
            captcha : {
                required : '验证码不能为空',
                remote   : '验证码不正确'
            }                     
        }
    });
    
  $("#send_submit").click(function(){
        var email = $("#email").val();
        var captcha = $('#captcha1').val();
        var is_captcha = false;
        if(captcha==''){
            alert('验证码不能为空'); 
            return;        
        }
        $.ajax({
            url:'index.php?app=captcha&act=check_captcha',
            async:false,
            type:"get",
            dataType:"json",
            data:'captcha='+captcha,
            success:function(data){
                if(!data){
                    alert('验证码不正确');
                    is_captcha = true ;
                }
  
            }
          });
        if(is_captcha){return;}         
        if(email && userValidate.chackEmail(email))
        {
           userValidate.sendEmail(email,'find_password_email');
           return;

        }
  });
  <!-- {/if}--> 
  <!-- {if $set_type eq 'mobile'}-->
  $('#find_password_form').validate({
        errorPlacement: function(error, element){
            $(element).next('.field_notice').hide();
            $(element).after(error);
        },
        success       : function(label){
            label.addClass('validate_right').text('OK!');
        },
        onkeyup: false,
        rules : {           
             mobile_verification_code : {
                required : true,
                isCode    : true, 
                remote   : {
                    url :'index.php?app=send_mobile&act=chack_verification_code',
                    type:'post',
                    data:{
                        mobile_verification_code : function(){
                            return $('#mobile_verification_code').val();
                        }
                    }
                }               
            }           
        },
        messages : {
             mobile_verification_code : {
                required : '验证码不能为空',
                isCode    : '验证码为6位的数字',
                remote    : '验证码不正确'
            }            
        }
    });   
  
  $("#send_mobile_code").click(function(){
        var phone_mob = $("#phone_mob").val();  
            
        if(phone_mob && userValidate.chacMobile(phone_mob))
        {
           userValidate.setMobileSession(phone_mob);
           userValidate.sendMobile(phone_mob,'find_password_mobile');
           $(".subbtnhsb").attr("disabled",false);
           return;

        }
  });
  <!-- {/if}--> 
<!-- {/if}-->   
});
function Goto(obj)
{
	if(obj.value !=""){
		window.location.href=obj.value;
	}
}

</script>
<!-- 内容 -->
<div class="content-warp">
  <div class="find-password">
   <!-- 第一步 -->
   <!-- {if $step eq 1}-->
    <div class="find-password-t"></div>
    <div class="find-password-c">
      <form action="" method="post" class="loginFrm" id="find_password_form">
        <table width="100%">
          <tr>
            <td width="150" align="right">账户名：</td>
            <td><input type="text" name="username" id="username" class="text width_normal b-radius" placeholder="账户名/邮箱/手机号码" /></td>
          </tr>
          <tr>
            <td align="right">验证码:</td>
            <td><input type="text" name="captcha" class="text width2 b-radius"  id="captcha1" style="vertical-align:middle;" />
              <a href="javascript:change_captcha($('#captcha'));" class="renewedly" title="点击换一张"><img id="captcha" src="index.php?app=captcha&amp;{$random_number}" style="vertical-align:middle;"  /></a></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="submit" value="下一步" class="subbtnhsbm" /></td>
          </tr>
        </table>
      </form>
    </div>
  <!--{/if}-->
  <!-- 第二步 -->
  <!-- {if $step eq 2}-->
    <div class="find-password-t t2"></div>
    <!-- 邮箱方式 -->
    <!-- {if $set_type eq 'email'}--> 
    <div class="find-password-c">
    <form method="post"  action="" id="find_password_form">
      <table width="100%">
        <tr>
          <td width="150" align="right">请选择验证身份的方式：</td>
          <td><select name="type" onchange="Goto(this)">
              <option selected="selected" value="index.php?app=find_password&set_type=email&step=2">邮箱</option>
              <option value="index.php?app=find_password&set_type=mobile&step=2">手机号码</option>
            </select></td>
        </tr>
        <!-- {if $safety_info.binding_email}-->
        <tr>
          <td align="right">绑定的邮箱：</td>
          <td class="f-cb"><span>{$safety_info.hide_email}</span><input type="hidden"  name="email" id="email" value="{$safety_info.binding_email}" /></td>
        </tr>
        <tr>
            <td align="right">验证码:</td>
            <td><input type="text" name="captcha" class="text width2 b-radius"  id="captcha1" style="vertical-align:middle;" />
              <a href="javascript:change_captcha($('#captcha'));" class="renewedly"><img id="captcha" src="index.php?app=captcha&amp;{$random_number}" style="vertical-align:middle;"  /></a></td>
          </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="button" class="subbtnhsb" value="发送验证邮箱"  id="send_submit" />
            <br/>
            <br/>
            <a style="display:none;" href="http://mail.qq.com" target="_blank" class="linkbtn" id="gotoemail">验证邮件已发送！前往查看</a>
          </td>
        </tr>
        <!--{else}-->
        <tr>
          <td colspan="2">您还没有绑定邮箱,不能通过邮箱找回密码,试下绑定手机方式吧!</td>
        </tr>
        <!--{/if}--> 
      </table>
     </form>
    </div>
    <!--{/if}--> 
    <!-- 手机方式 -->
    <!-- {if $set_type eq 'mobile'}--> 
    <div class="find-password-c">
    <form method="post"  action="" id="find_password_form">
      <table width="100%">
        <tr>
          <td width="150" align="right">请选择验证身份的方式：</td>
          <td><select name="type" onchange="Goto(this)">
              <option value="index.php?app=find_password&set_type=email&step=2">邮箱</option>
              <option selected="selected" value="index.php?app=find_password&set_type=mobile&step=2">手机号码</option>
            </select></td>
        </tr>
        <!-- {if $safety_info.binding_mobile}-->
        <tr>
          <td align="right">绑定的手机：</td>
          <td class="f-cb"><span>{$safety_info.hide_mobile}</span><input type="hidden" name="phone_mob" id="phone_mob" value="{$safety_info.binding_mobile}" /></td>
        </tr>
        <tr>
          <td align="right">短信验证码：</td>
          <td class="f-cb"><input type="text" class="text width2 b-radius" name="mobile_verification_code" maxlength="6" id="mobile_verification_code" disabled="disabled" />
                &nbsp;&nbsp;
                <input class="button_on b-radius" type="button" value="获取短信验证码" id="send_mobile_code" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" disabled="" name="submit" value="下一步" class="subbtnhsb" /></td>
        </tr>
         <!--{else}-->
        <tr>
          <td colspan="2">您还没有绑定手机,不能通过手机找回密码,试下绑定邮箱方式吧!</td>
        </tr>
        <!--{/if}-->
      </table>
      </form>
    </div>
    <!--{/if}--> 
  <!--{/if}-->  
  </div>
</div>
<!-- 页脚 -->
{include file="footer.html"} 